package com.zxx.mvpPractice.utils;

import android.content.Context;
import android.content.Intent;

import com.zxx.mvpPractice.ui.activitys.LoginActivity;
import com.zxx.mvpPractice.ui.activitys.MainActivity;
import com.zxx.mvpPractice.ui.activitys.WelcomeActivity;


/**
 * Description: JumpUtil
 * Creator: yxc
 * date: 2016/9/21 14:46
 */
public class JumpUtil {

    public static void go2MainActivity(Context context) {
        jump(context, MainActivity.class);
        if (context instanceof WelcomeActivity) {
            ((WelcomeActivity) context).finish();
        }
        if (context instanceof LoginActivity) {
            ((LoginActivity) context).finish();
        }
    }

    public static void go2RegisterLoginActivity(Context context) {
        jump(context, LoginActivity.class);
    }

    public static void go2LoginActivity(Context context) {
        jump(context, LoginActivity.class);
    }

    private static void jump(Context a, Class<?> clazz) {
        Intent intent = new Intent(a, clazz);
        a.startActivity(intent);
    }
}
